<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="<%=basePath%>">
<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css" href="bootstrap-rs/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="bootstrap-rs/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="bootstrap-rs/demo.css">
	<script type="text/javascript" src="bootstrap-rs/jquery.min.js"></script>
	<script type="text/javascript" src="bootstrap-rs/jquery.easyui.min.js"></script>

<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
</head>
<body>
	<form action="sys/user/update" method="post" class="definewidth m20">
		<table class="table table-bordered table-hover m10">
				<tr>
				<td>
				<input type="hidden" name="user.nUserid" value="${dto.user.nUserid}"/>
				</td>
				</tr>
			<tr>
				<td class="tableleft">用户名</td>
				<td><input type="text" name="user.vUsername" value="${dto.user.vUsername }"/></td>
			</tr>
			<tr>
				<td class="tableleft">真实姓名</td>
				<td><input type="text" name="user.vRealname" value="${dto.user.vRealname }" /></td>
			</tr>
			<tr>
				<td class="tableleft">性别</td>
				<td><input type="radio" name="user.vSex" value="男" checked /> 男
					<input type="radio" name="user.vSex" value="女" /> 女</td>
			</tr>
			<tr>
				<td class="tableleft">籍贯</td>
				<td><input type="text" name="user.vBirthplace" value="${dto.user.vBirthplace }" /></td>
			</tr>
			<tr>
				<td class="tableleft">身份证</td>
				<td><input type="number" name="user.vIndetification" value="${dto.user.vIndetification }" /></td>
			</tr>
			<tr>
				<td class="tableleft">电话</td>
				<td><input type="number" name="user.nMobile" value="${dto.user.nMobile }" /></td>
			</tr>
			<tr>
				<td class="tableleft">手机号码</td>
				<td><input type="number" name="user.nTelphone" value="${dto.user.nTelphone }" /></td>
			</tr>
			<tr>
				<td class="tableleft">电子邮件</td>
				<td><input type="email" name="user.vEmail" value="${dto.user.vEmail }" /></td>
			</tr>
			<tr>
				<td class="tableleft">地址</td>
				<td><input type="text" name="user.vAddress" value="${dto.user.vAddress }" /></td>
			</tr>
			<tr>
				<td class="tableleft">角色</td>
				<td><c:forEach items="${roles }" var="role">
					<!-- 定义一个变量 记录当前角色是否是该用户具有的角色 默认不是 -->
					<c:set var="flag" value="false"></c:set>
					<!-- 循环取出该用户具有的角色 -->
					<c:forEach items="${userRoles }" var="r" >
						<c:if test="${r.nRoleid eq role.nRoleid }">
							<c:set var="flag" value="true"></c:set>
						</c:if>
					</c:forEach>
				<input type="checkbox" name="rids" ${flag eq true?'checked':'' } value="${role.nRoleid }" />${role.vRolename }
				</c:forEach></td>
			</tr>


			<tr>
				<td class="tableleft"></td>
				<td>
					<button type="submit" class="btn btn-primary" type="button">保存</button>
					&nbsp;&nbsp;
					<button type="button" class="btn btn-success" name="backid"
						id="backid">返回</button>
						&nbsp;&nbsp;
							<button type="reset" class="btn btn-success" name="reset"
							>重置</button>
				</td>
			</tr>
		</table>
	</form>
</body>
<script type="text/javascript">
	$(function() {
		$('#backid').click(function() {
			window.location.href = "sys/user/query";
		});

	});
</script>
</html>
